package com.example.demo.controller;

import com.example.demo.annotation.Roles;
import com.example.demo.dto.OkDTO;
import com.example.demo.pojo.Result;
import com.example.demo.service.ElderlyServiceOkService;
import com.example.demo.vo.ElderlyServiceVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("service")
@Slf4j
@Tag(name = "服务接口")
@RequiredArgsConstructor
public class ElderlyServerOkController {
    private final ElderlyServiceOkService elderlyServiceOkService;
    @PostMapping("/ok")
    @Operation(summary = "确认服务")
    @Roles(values = "da")
    public Result ok(@RequestBody OkDTO okDTO) {
        elderlyServiceOkService.ok(okDTO);
        return Result.success();
    }

    @GetMapping("/elderly/ok")
    @Operation(summary = "获取未确认老人服务信息")
    @Roles(values = {"ru", "da"})
    public Result<List<ElderlyServiceVO>> getElderlyService() {
        return Result.success(elderlyServiceOkService.getElderlyService());
    }

}
